#ifndef __PRIVATE_HID_H__
#define __PRIVATE_HID_H__

template <typename T> static inline T *qGetPtrHelper(T *ptr) { return ptr; }  
template <typename Wrapper> static inline typename Wrapper::pointer qGetPtrHelper(const Wrapper &p) { return p.data(); }

#define E_DECLARE_PRIVATE(Class)\
    inline Class##Private* d_func(){ return reinterpret_cast<Class##Private *>(qGetPtrHelper(d_ptr));}\
    inline const Class##Private* d_func() const { return reinterpret_cast<const Class##Private *>(qGetPtrHelper(d_ptr)); } \
    friend class Class##Private;
  
#define E_DECLARE_PRIVATE_D(Dptr, Class)\
    inline Class##Private* d_func(){ return reinterpret_cast<Class##Private *>(Dptr); }\
    inline const Class##Private* d_func() const { return reinterpret_cast<const Class##Private *>(Dptr); }\
    friend class Class##Private;
  
#define E_DECLARE_PUBLIC(Class)\
    inline Class* q_func() { return static_cast<Class *>(q_ptr); } \
    inline const Class* q_func() const { return static_cast<const Class *>(q_ptr); } \
    friend class Class;
  
#define E_D(Class) Class##Private * const d = d_func()
#define E_Q(Class) Class * const q = q_func()

#endif //__PRIVATE_HID_H__